<?php
$v_record_id = 0;

if(isset($_REQUEST['hdn_record_id'])){
//	$v_record_id = intval($_REQUEST['hdn_record_id']);
	$v_record_id = ($_REQUEST['hdn_record_id']);
}

//echo $v_record_id ;
if(_is_sqlserver()){//CSDL MSSQL 
	$v_record_id_list = explode(',',$_REQUEST['hdn_record_id']);
	
	// Lay noi dung cua mot ho so
	if(sizeof($v_record_id_list) <=1){
		$v_record_id = intval($v_record_id);
		$sql = "Exec Onegate_RecordGetSingle " . $v_record_id ;
		$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
		$arr_single_record = $ado_conn->GetRow($sql); 
		$arr_single_record[C_RECEIVED_RECORD_XML_DATA] = stripslashes($arr_single_record[C_RECEIVED_RECORD_XML_DATA]);
		$arr_single_record[C_LICENSE_XML_DATA] = stripslashes($arr_single_record[C_LICENSE_XML_DATA]);
		//var_dump($arr_single_record[C_RECEIVED_RECORD_XML_DATA]);
	}	
	// Lay noi dung cua nhieu ho so
	else{
//		$v_record_id = intval($v_record_id_list[0]);
		$sql = "Exec Onegate_RecordGetAllByID '" . $v_record_id. "'" ;
		$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
		$arr_all_record = $ado_conn->GetAll($sql); 
		
		$v_count = sizeof($arr_all_record);
		for($i=0;$i<$v_count;$i++){
			$arr_all_record[$i]['C_RECEIVED_RECORD_XML_DATA'] = stripslashes($arr_all_record[$i]['C_RECEIVED_RECORD_XML_DATA']);
			$arr_all_record[$i]['C_LICENSE_XML_DATA'] = stripslashes($arr_all_record[$i]['C_LICENSE_XML_DATA']);
		}
		//var_dump($arr_all_record);
	}
//		echo $sql;
	
		//$v_recordtype_name2 = $arr_single_record['C_RECORDTYPE_NAME'];
		//Bo sung ngay dang ky DatCQ
//		$v_record_relate = _XML_get_xml_tag_value($arr_single_record[C_RECEIVED_RECORD_XML_DATA],'relate_record');
//		echo $v_record_relate;
/*		if($v_record_relate!= ''){
			$sql = "select  dbo.f_GetValueOfXMLtag(c_license_xml_data, 'record_date') as NgayDangKy
					from T_ONEGATE_RECORD 
					where C_CODE like '".$v_record_relate."'";
			$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
			$arr_single_record_date = $ado_conn->GetRow($sql); 
		}*/
}
?>